using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class BGMusic : MonoBehaviour
{
    [SerializeField] AudioController controller;
    [SerializeField] float Delaytime;

    private void Awake()
    {
        controller = new AudioController();
        float bglenth = controller.PlayBgm(EBgmType.BG3intro);
        if (bglenth != -1)
            StartCoroutine(AudioPlayChange(bglenth));
    }

    private IEnumerator AudioPlayChange(float time)
    {
        yield return new WaitForSeconds((int)time - Delaytime);
        controller.PlayBgm(EBgmType.BG3loop);
    }
    

}
